package pro.cherish.smartfile.common.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

/**
 * 异常枚举类型
 */
@Getter
public enum ExceptionEnum implements BaseEnum {
    COMMON_EXCEPTION("1000", "发生未知错误"),
    REQUEST_ARGS_ERROR("1001", "请求参数错误");

    private String code;
    private String msg;

    ExceptionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String getDesc() {
        return StrUtil.format("code={},message={}", code, msg);
    }

    @Override
    public boolean eq(String val) {
        return this.code.equals(val);
    }
}
